﻿using MvvmCross.Core.ViewModels;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Sidvall.UI.ViewModels
{
    public sealed class WebControlViewModel : ControlViewModelBase
    {
        #region Public Members

        public event System.EventHandler CloseSelected;

        #region ActionCaption

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")]
        public string ActionCaption
        {
            get
            {
                return Sidvall.Resources.ResourceKeyManager.Current.OkOptionId;
            }
        }

        #endregion

        // Commands
        #region ActionCommand

        public ICommand ActionCommand
        {
            get
            {
                return new MvxCommand(async () => await ActionAsync());
            }
        }
        public Task ActionAsync()
        {
            OnCloseSelected();
            return Task.FromResult(true);
        }

        #endregion

        #endregion
        #region Private Members

        #region OnCloseSelected

        private void OnCloseSelected()
        {
            OnCloseSelected(new System.EventArgs());
        }
        private void OnCloseSelected(System.EventArgs args)
        {
            if (this.CloseSelected != null)
                this.CloseSelected.Invoke(this, args);
        }

        #endregion

        #endregion
        #region Constructors

        public WebControlViewModel()
        {
        }

        #endregion
    }
}
